package org.csu.mypetstore.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 */
@Configuration
public class AlipayConfig {


    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016102800773861";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCHv+f/z5V+b7kerDv1iC8NkN14Dj2kyHjlSDYhUl2qV7b0h1S4TOdgWJCkdvnI1mfzWkrFB2hEpk09/QE05V/dFarZ1omXdavYFJORiVzzTUq1rto0rA9QiDaRtMT2+UEGfSFPLsDMxXXjWgOgsoQB1SEvaqYKR2c1h7rLp/M8uNgAuACTS2ANyeCNbAbAGnoLVSkOgRzBBk/5GsP8I8CiedBFNmyQKU8qi8soFeAUMfxYNBH+pnG27qT40emro6azXaS1mcI1OzY8VSug1DxSaB8/xR98a7494crljSVj6G930rOtC5q4Mr+tHge3PoGfl4oQdWM+ZojMxMFq+LepAgMBAAECggEAaLXmxrPgpH6ZVMeWGHbLlLNBofGaKxlX58QjvOBDz7mJLmWVO/RWJUMrjzEWy4xW8qebNQ/ZpdqBimc2Hw8vOuITv6R0zZe+zhZRHdnPEP11u178gdSWm4/2R74gkEEDn3W109ZEca9+l7g/RB1vJdq4llK1cQhS3D+uHpmWTic+gy4e23zxMrNoMdhCnWE4HciqnNFQ1sUmpaDcU6CW+32UIuPNume3NeAdOWcbwDOBu32nFwMFwZ7TmWO2MCZ0GmtX1BwuQLPGBGHI3FRd+HkO5wIaRxabkBHOLVFIoRzJNbRAcjkY3194vj3xexcMCKYDUjztZ9A/DAp2eBvHYQKBgQDt8wtwrMDjS5cjbIUR8S6ZHJ2EMtzjw8QNRt7hOS5/irCxdvK6j+17wVOD7mZQAaO4MQ5OddHqxzrD6hW0LenEcqEcfRNG81wFzG0g2bo6mneGzQAm0x3KjjEr7m+1uls1ynxQSLPUC/6K263WvCHynde3giEP6AdndNmN31YazwKBgQCSDCbRucFRXwpK2yMN+ojBs8RxqaD+U4+nJ1vXJvWGTvs8iimu2Zj02KIfUAbh1KfxBp5wLRlAyQfBLEXAeIRYTXXTdKqbW/OnlZWSduaA3Q3uDSiLjfQz59qZ3XkgfQAwTlkSSw4btN81wvD7lHMZKCUf7xzySQ4Hjj0a+1FEBwKBgCWqYVc2oVnZb1U2KmJKsTufYfe5LWoIZRJM857nNEsQIyQUVhveCJOcaKHrrNphSA8yBLe6wr3NR6oXddQNqIFmO8aMre5/O0PXtjaLAIWiSeVWsf1zUbXsiDASEDDODP4YzVDQEVcxhttoJr5lDWKgRbNQr/canYFs57sjbTfVAoGAG9X7FCAOa37szEWmEcT9icXEnFFTYQX2LErBI2nGhBnLosdGmI/aqlgb1lH/bc2FUNgNHJ5L4OAv/S5+AOg3eUkSOwJSfhfxgbBt+KN23XrEa+nQH4En2TjInmjq7DlG7u4P5f+uKbO4k1ubaKfrpBDVupdtcfRgmyoOFXVvEMMCgYEAiIo12uPmJ08Xa8tfUH3UC/O4xK4XRU+/wQhxl0OJK7u5cj6igjRNMDPM6obA1WpZ8p9qXuikUmMQAZP/UpXqnlCzoIpT7UMs4Ut+LRvSWlH2QhpK3JF+YlDZDbKI5buDlrtA63prXc5Y/8930tuehMHkbaZZKDXYgTmZQNGzwg0=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6lU/KJqiDku5jZ/Nt39W8pRgJWYh8e3LvCyTc76QFPUKnr+Kl1jd3h9lZ5K5Oo0qhCQYMBTtE9zOVeo1uwIXbECBeVxHj4A2kx9c7lK1LfUzZjkYa4fSBJKtcha1u8gmye3FdoW+uMJ5BvC1t21aUBB0k3ryfemR55onXzgK2YYRw1HujVJtpmdMwLbw+q/h8OeQuU9sE3ZWDTNg3kFecE+3XQF84eW6FdTJK9oe9ZGa7+8iuty2XnjH5eA0NsZoKtt64OkEI6mxv2dJFqjkTXbXW206RiT02PI13xSFfNW/T+uVCVLQiw5FDf0nnSpz2Auy0OxuVuJXmgxwLf+ydwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    //public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";
    public static String notify_url = "http://localhost:80/alipay/alipayNotifyNotice";//这里根据你项目中的controller进行配置

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    //public static String return_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";
    public static String return_url = "http://localhost:80/order/viewMyOrder";//这里根据你项目中的controller进行配置

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    //public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";//项目正式使用后使用
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";//使用沙箱环境时使用

    // 支付宝网关
    public static String log_path = "C:\\";


    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

